<!DOCTYPE html>

<html>
<head>
<meta charset="UTF-8">
<link href="style.css" type="text/css" rel="stylesheet">
<title>VPERMPD—Permute Double-Precision Floating-Point Elements </title></head>
<body>
<h1>VPERMPD—Permute Double-Precision Floating-Point Elements</h1>
<table>
<tr>
<th>Opcode/Instruction</th>
<th>Op / En</th>
<th>64/32 bit Mode Support</th>
<th>CPUID Feature Flag</th>
<th>Description</th></tr>
<tr>
<td>
<p>VEX.256.66.0F3A.W1 01 /r ib</p>
<p>VPERMPD ymm1, ymm2/m256, imm8</p></td>
<td>RMI</td>
<td>V/V</td>
<td>AVX2</td>
<td>Permute double-precision floating-point elements in ymm2/m256 using indices in imm8 and store the result in ymm1.</td></tr>
<tr>
<td>
<p>EVEX.256.66.0F3A.W1 01 /r ib</p>
<p>VPERMPD ymm1 {k1}{z}, ymm2/m256/m64bcst, imm8</p></td>
<td>FV-RM</td>
<td>V/V</td>
<td>
<p>AVX512VL</p>
<p>AVX512F</p></td>
<td>Permute double-precision floating-point elements in ymm2/m256/m64bcst using indexes in imm8 and store the result in ymm1 subject to writemask k1.</td></tr>
<tr>
<td>
<p>EVEX.512.66.0F3A.W1 01 /r ib</p>
<p>VPERMPD zmm1 {k1}{z}, zmm2/m512/m64bcst, imm8</p></td>
<td>FV-RMI</td>
<td>V/V</td>
<td>AVX512F</td>
<td>Permute double-precision floating-point elements in zmm2/m512/m64bcst using indices in imm8 and store the result in zmm1 subject to writemask k1.</td></tr>
<tr>
<td>
<p>EVEX.NDS.256.66.0F38.W1 16 /r</p>
<p>VPERMPD ymm1 {k1}{z}, ymm2, ymm3/m256/m64bcst</p></td>
<td>FV-RVM</td>
<td>V/V</td>
<td>
<p>AVX512VL</p>
<p>AVX512F</p></td>
<td>Permute double-precision floating-point elements in ymm3/m256/m64bcst using indexes in ymm2 and store the result in ymm1 subject to writemask k1.</td></tr>
<tr>
<td>
<p>EVEX.NDS.512.66.0F38.W1 16 /r</p>
<p>VPERMPD zmm1 {k1}{z}, zmm2, zmm3/m512/m64bcst</p></td>
<td>FV-RVM</td>
<td>V/V</td>
<td>AVX512F</td>
<td>Permute double-precision floating-point elements in zmm3/m512/m64bcst using indices in zmm2 and store the result in zmm1 subject to writemask k1.</td></tr></table>
<h3>Instruction Operand Encoding</h3>
<table>
<tr>
<td>Op/En</td>
<td>Operand 1</td>
<td>Operand 2</td>
<td>Operand 3</td>
<td>Operand 4</td></tr>
<tr>
<td>RMI</td>
<td>ModRM:reg (w)</td>
<td>ModRM:r/m (r)</td>
<td>Imm8</td>
<td>NA</td></tr>
<tr>
<td>FV-RMI</td>
<td>ModRM:reg (w)</td>
<td>ModRM:r/m (r)</td>
<td>Imm8</td>
<td>NA</td></tr>
<tr>
<td>FV-RVM</td>
<td>ModRM:reg (w)</td>
<td>EVEX.vvvv (r)</td>
<td>ModRM:r/m (r)</td>
<td>NA</td></tr></table>
<p><strong>Description</strong></p>
<p>The imm8 version: Copies quadword elements of double-precision floating-point values from the source operand (the second operand) to the destination operand (the first operand) according to the indices specified by the imme-diate operand (the third operand). Each two-bit value in the immediate byte selects a qword element in the source operand.</p>
<p>VEX version: The source operand can be a YMM register or a memory location. Bits (MAX_VL-1:256) of the corre-sponding destination register are zeroed.</p>
<p>In EVEX.512 encoded version, The elements in the destination are updated using the writemask k1 and the imm8 bits are reused as control bits for the upper 256-bit half when the control bits are coming from immediate. The source operand can be a ZMM register, a 512-bit memory location or a 512-bit vector broadcasted from a 64-bit memory location.</p>
<p>The imm8 versions: VEX.vvvv and EVEX.vvvv are reserved and must be 1111b otherwise instructions will #UD.</p>
<p>The vector control version: Copies quadword elements of double-precision floating-point values from the second source operand (the third operand) to the destination operand (the first operand) according to the indices in the first source operand (the second operand). The first 3 bits of each 64 bit element in the index operand selects which quadword in the second source operand to copy. The first and second operands are ZMM registers, the third operand can be a ZMM register, a 512-bit memory location or a 512-bit vector broadcasted from a 64-bit memory location. The elements in the destination are updated using the writemask k1.</p>
<p>Note that this instruction permits a qword in the source operand to be copied to multiple locations in the destination operand.</p>
<p>If VPERMPD is encoded with VEX.L= 0, an attempt to execute the instruction encoded with VEX.L= 0 will cause an #UD exception.</p>
<p><strong>Operation</strong></p>
<p><strong>VPERMPD (EVEX - imm8 control forms)</strong></p>
<p>(KL, VL) = (4, 256), (8, 512)</p>
<p>FOR j (cid:197) 0 TO KL-1</p>
<p>i (cid:197) j * 64</p>
<p>IF (EVEX.b = 1) AND (SRC *is memory*)</p>
<p>THEN TMP_SRC[i+63:i] (cid:197) SRC[63:0];</p>
<p>ELSE TMP_SRC[i+63:i] (cid:197) SRC[i+63:i];</p>
<p>FI;</p>
<p>ENDFOR;</p>
<p>TMP_DEST[63:0] (cid:197) (TMP_SRC[256:0] &gt;&gt; (IMM8[1:0] * 64))[63:0];</p>
<p>TMP_DEST[127:64] (cid:197) (TMP_SRC[256:0] &gt;&gt; (IMM8[3:2] * 64))[63:0];</p>
<p>TMP_DEST[191:128] (cid:197) (TMP_SRC[256:0] &gt;&gt; (IMM8[5:4] * 64))[63:0];</p>
<p>TMP_DEST[255:192] (cid:197) (TMP_SRC[256:0] &gt;&gt; (IMM8[7:6] * 64))[63:0];</p>
<p>IF VL &gt;= 512</p>
<p>TMP_DEST[319:256] (cid:197) (TMP_SRC[511:256] &gt;&gt; (IMM8[1:0] * 64))[63:0];</p>
<p>TMP_DEST[383:320] (cid:197) (TMP_SRC[511:256] &gt;&gt; (IMM8[3:2] * 64))[63:0];</p>
<p>TMP_DEST[447:384] (cid:197) (TMP_SRC[511:256] &gt;&gt; (IMM8[5:4] * 64))[63:0];</p>
<p>TMP_DEST[511:448] (cid:197) (TMP_SRC[511:256] &gt;&gt; (IMM8[7:6] * 64))[63:0];</p>
<p>FI;</p>
<p>FOR j (cid:197) 0 TO KL-1</p>
<p>i (cid:197) j * 64</p>
<p>IF k1[j] OR *no writemask*</p>
<p>THEN DEST[i+63:i] (cid:197) TMP_DEST[i+63:i]</p>
<p>ELSE</p>
<p>IF *merging-masking*</p>
<p>; merging-masking</p>
<p>THEN *DEST[i+63:i] remains unchanged*</p>
<p>ELSE</p>
<p>; zeroing-masking</p>
<p>DEST[i+63:i] (cid:197) 0</p>
<p>;zeroing-masking</p>
<p>FI;</p>
<p>FI;</p>
<p>ENDFOR</p>
<p>DEST[MAX_VL-1:VL] (cid:197)(cid:3)0</p>
<p><strong>VPERMPD (EVEX - vector control forms)</strong></p>
<p>(KL, VL) = (4, 256), (8, 512)</p>
<p>FOR j (cid:197) 0 TO KL-1</p>
<p>i (cid:197) j * 64</p>
<p>IF (EVEX.b = 1) AND (SRC2 *is memory*)</p>
<p>THEN TMP_SRC2[i+63:i] (cid:197) SRC2[63:0];</p>
<p>ELSE TMP_SRC2[i+63:i] (cid:197) SRC2[i+63:i];</p>
<p>FI;</p>
<p>ENDFOR;</p>
<p>IF VL = 256</p>
<p>TMP_DEST[63:0] (cid:197) (TMP_SRC2[255:0] &gt;&gt; (SRC1[1:0] * 64))[63:0];</p>
<p>TMP_DEST[127:64] (cid:197) (TMP_SRC2[255:0] &gt;&gt; (SRC1[65:64] * 64))[63:0];</p>
<p>TMP_DEST[191:128] (cid:197) (TMP_SRC2[255:0] &gt;&gt; (SRC1[129:128] * 64))[63:0];</p>
<p>TMP_DEST[255:192] (cid:197) (TMP_SRC2[255:0] &gt;&gt; (SRC1[193:192] * 64))[63:0];</p>
<p>FI;</p>
<p>IF VL = 512</p>
<p>TMP_DEST[63:0] (cid:197) (TMP_SRC2[511:0] &gt;&gt; (SRC1[2:0] * 64))[63:0];</p>
<p>TMP_DEST[127:64] (cid:197) (TMP_SRC2[511:0] &gt;&gt; (SRC1[66:64] * 64))[63:0];</p>
<p>TMP_DEST[191:128] (cid:197) (TMP_SRC2[511:0] &gt;&gt; (SRC1[130:128] * 64))[63:0];</p>
<p>TMP_DEST[255:192] (cid:197) (TMP_SRC2[511:0] &gt;&gt; (SRC1[194:192] * 64))[63:0];</p>
<p>TMP_DEST[319:256] (cid:197) (TMP_SRC2[511:0] &gt;&gt; (SRC1[258:256] * 64))[63:0];</p>
<p>TMP_DEST[383:320] (cid:197) (TMP_SRC2[511:0] &gt;&gt; (SRC1[322:320] * 64))[63:0];</p>
<p>TMP_DEST[447:384] (cid:197) (TMP_SRC2[511:0] &gt;&gt; (SRC1[386:384] * 64))[63:0];</p>
<p>TMP_DEST[511:448] (cid:197) (TMP_SRC2[511:0] &gt;&gt; (SRC1[450:448] * 64))[63:0];</p>
<p>FI;</p>
<p>FOR j (cid:197) 0 TO KL-1</p>
<p>i (cid:197) j * 64</p>
<p>IF k1[j] OR *no writemask*</p>
<p>THEN DEST[i+63:i] (cid:197) TMP_DEST[i+63:i]</p>
<p>ELSE</p>
<p>IF *merging-masking*</p>
<p>; merging-masking</p>
<p>THEN *DEST[i+63:i] remains unchanged*</p>
<p>ELSE</p>
<p>; zeroing-masking</p>
<p>DEST[i+63:i] (cid:197) 0</p>
<p>;zeroing-masking</p>
<p>FI;</p>
<p>FI;</p>
<p>ENDFOR</p>
<p>DEST[MAX_VL-1:VL] (cid:197)(cid:3)0</p>
<p><strong>VPERMPD (VEX.256 encoded version)</strong></p>
<p>DEST[63:0] (cid:197)(SRC[255:0] &gt;&gt; (IMM8[1:0] * 64))[63:0];</p>
<p>DEST[127:64] (cid:197)(SRC[255:0] &gt;&gt; (IMM8[3:2] * 64))[63:0];</p>
<p>DEST[191:128] (cid:197)(SRC[255:0] &gt;&gt; (IMM8[5:4] * 64))[63:0];</p>
<p>DEST[255:192] (cid:197)(SRC[255:0] &gt;&gt; (IMM8[7:6] * 64))[63:0];</p>
<p>DEST[MAX_VL-1:256] (cid:197)(cid:3)0</p>
<p><strong>Intel C/C++ Compiler Intrinsic Equivalent</strong></p>
<p>VPERMPD __m512d _mm512_permutex_pd( __m512d a, int imm);</p>
<p>VPERMPD __m512d _mm512_mask_permutex_pd(__m512d s, __mmask16 k, __m512d a, int imm);</p>
<p>VPERMPD __m512d _mm512_maskz_permutex_pd( __mmask16 k, __m512d a, int imm);</p>
<p>VPERMPD __m512d _mm512_permutexvar_pd( __m512i i, __m512d a);</p>
<p>VPERMPD __m512d _mm512_mask_permutexvar_pd(__m512d s, __mmask16 k, __m512i i, __m512d a);</p>
<p>VPERMPD __m512d _mm512_maskz_permutexvar_pd( __mmask16 k, __m512i i, __m512d a);</p>
<p>VPERMPD __m256d _mm256_permutex_epi64( __m256d a, int imm);</p>
<p>VPERMPD __m256d _mm256_mask_permutex_epi64(__m256i s, __mmask8 k, __m256d a, int imm);</p>
<p>VPERMPD __m256d _mm256_maskz_permutex_epi64( __mmask8 k, __m256d a, int imm);</p>
<p>VPERMPD __m256d _mm256_permutexvar_epi64( __m256i i, __m256d a);</p>
<p>VPERMPD __m256d _mm256_mask_permutexvar_epi64(__m256i s, __mmask8 k, __m256i i, __m256d a);</p>
<p>VPERMPD __m256d _mm256_maskz_permutexvar_epi64( __mmask8 k, __m256i i, __m256d a);</p>
<p><strong>SIMD Floating-Point Exceptions</strong></p>
<p>None</p>
<p><strong>Other Exceptions</strong></p>
<p>Non-EVEX-encoded instruction, see Exceptions Type 4; additionally</p>
<table>
<tr>
<td>#UD</td>
<td>
<p>If VEX.L = 0.</p>
<p>If VEX.vvvv != 1111B.</p>
<p>EVEX-encoded instruction, see Exceptions Type E4NF.</p></td></tr>
<tr>
<td>#UD</td>
<td>
<p>If encoded with EVEX.128.</p>
<p>If EVEX.vvvv != 1111B and with imm8.</p></td></tr></table></body></html>